package yzx.firstletter;

import android.support.v4.app.Fragment;

import java.util.ArrayList;

public class BaseFragment extends Fragment {

    private final ArrayList<Runnable> onResumeCallbackOnceList = new ArrayList<>(0);

    @Override
    public void onResume() {
        super.onResume();

        if(!onResumeCallbackOnceList.isEmpty()){
            for (Runnable runnable : onResumeCallbackOnceList)
                runnable.run();
            onResumeCallbackOnceList.clear();
        }
    }


    public void addOnResumeCallbackOnce(Runnable run){
        if(onResumeCallbackOnceList.contains(run))
            return ;
        onResumeCallbackOnceList.add(run);
    }


}
